From 29ed3a4366eb9719d32dac390764bf119c40afff Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 22 Jan 2023 21:03:57 -0800 Subject: rename txns --- .../[username]/payments/[...page]/+page.svelte | 51 +++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'src/routes/(app)/[username]') diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index 24f7cf6e..e28ade67 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -2,7 +2,7 @@ import { Avatar, Icon } from '$comp'; import { onMount } from 'svelte'; import { format, parseISO } from 'date-fns'; - import { newPayment, txns } from '$lib/store'; + import { newPayment, payments } from '$lib/store'; import { t } from '$lib/translations'; import { f, s, sat, sats } from '$lib/utils'; import { page } from '$app/stores'; @@ -20,10 +20,10 @@ let { start, end, user } = data; let change = ({ target: { value } }) => goto(value); - let link = (tx) => { - if (tx.redeemcode) return `/voucher/${tx.redeemcode}`; - if (tx.with) return '/' + tx.with.username; - return `/tx/${tx.hash}`; + let link = (p) => { + if (p.pot) return `/pot/${p.pot}`; + if (p.with) return '/' + p.with.username; + return `/p/${p.id}`; }; let presets = [ @@ -39,9 +39,8 @@ let p, total, - payments = [], pages = []; - $: data && ({ page: p, pages, start, end, total, payments: $txns } = data); + $: data && ({ page: p, pages, start, end, total, payments: $payments } = data); $: $page && ($newPayment = false); $: $newPayment && invalidate(`/users/${user.username}`); @@ -55,7 +54,7 @@ const csv = keys.map((k) => `"${k}"`).join(',') + '\n' + - $txns.map((r) => keys.map((k) => `"${r[k]}"`).join(',')).join('\n'); + $payments.map((r) => keys.map((k) => `"${r[k]}"`).join(',')).join('\n'); const filename = 'payments.csv'; let blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' }); @@ -112,34 +111,34 @@
- {#each $txns as tx} - + {#each $payments as p} +
- {f(tx.amount * (tx.rate / sats), tx.currency)} + {f(p.amount * (p.rate / sats), p.currency)} - {#if tx.tip} + {#if p.tip} - +{f(tx.tip * (tx.rate / sats), tx.currency)} + +{f(p.tip * (p.rate / sats), p.currency)} {/if}
- {sat(tx.amount)} + {sat(p.amount)} - {#if tx.tip} + {#if p.tip} - +{sat(tx.tip)} + +{sat(p.tip)} {/if}
- {#if tx.type === types.pot} - + {#if p.type === types.pot} +
@@ -148,18 +147,18 @@
Pot
- {:else if tx.type === types.internal} - + {:else if p.type === types.internal} +
- +
-
{tx.with.username}
+
{p.with.username}
{:else}
- {#if tx.type === 'lightning'} + {#if p.type === types.lightning}
⚡️
{:else}
@@ -168,7 +167,7 @@ {/if}
- {tx.amount > 0 ? (tx.confirmed ? 'Received' : 'Pending') : 'Sent'} + {p.amount > 0 ? (p.confirmed ? 'Received' : 'Pending') : 'Sent'}
{/if} @@ -176,10 +175,10 @@
- {format(new Date(tx.created), 'h:mm aaa')} + {format(new Date(p.created), 'h:mm aaa')}
- {format(new Date(tx.created), 'MMM d')} + {format(new Date(p.created), 'MMM d')}
-- cgit v1.2.3